; *** Senat
; *** Copyright 1998-2002 Zillions Development
; v.2.0

; You need to purchase Zillions of Games to load this rules file
; Visit the Zillions web site at http://www.zillions-of-games.com

(version "2.0")
(translate
 ("Senat" "塞内特(Senat)")
 ("Red" "红方") ("Green" "绿方")
 ("Red-Ball" "红棋") ("Green-Ball" "绿棋")
 ("?Dice-Toss" "掷点结果：")
 ("1dice" "1点") ("2dice" "2点") ("3dice" "3点") ("4dice" "4点") ("5dice" "5点")
 ("roll-place" " ") ("roll" "掷骰子")
 ("aoff" "起点") ("boff" "起点") ("coff" "起点") ("doff" "起点")
 ("eoff" "起点") ("foff" "起点") ("goff" "起点") ("hoff" "起点")
 ("rfin1" "终点") ("rfin2" "终点") ("rfin3" "终点") ("rfin4" "终点")
 ("gfin1" "终点") ("gfin2" "终点") ("gfin3" "终点") ("gfin4" "终点")
 ("a1" "1") ("b1" "2") ("c1" "3") ("d1" "4") ("e1" "5")
 ("f1" "6") ("g1" "7") ("h1" "8") ("i1" "9") ("j1" "10")
 ("j2" "11") ("i2" "12") ("h2" "13") ("g2" "14") ("f2" "15")
 ("e2" "16") ("d2" "17") ("c2" "18") ("b2" "19") ("a2" "20")
 ("a3" "21") ("b3" "22") ("c3" "23") ("d3" "24") ("e3" "25")
 ("f3" "26") ("g3" "27") ("h3" "28") ("i3" "29") ("j3" "30")
)

(define put-on-board
  ((verify (in-zone? off-board)) mark roll-place (verify (piece? $2)) capture $1 (verify empty?) 
             add)
)

(define place-in-finishr rfin1 (while not-empty? finr) to )
(define place-in-finishg gfin1 (while not-empty? fing) to )


(define board-defs
  (image "images\Senat\Senat.bmp")
  (grid
     (start-rectangle 0 7 49 57)
     (dimensions
         ("a/b/c/d/e/f/g/h/i/j" (48 0)) ; files
         ("3/2/1/off" (0 48)) ; ranks
     )    
  )
  (kill-positions ioff joff)
  (links e (a1 b1) (b1 c1) (c1 d1) (d1 e1) (e1 f1) (f1 g1) (g1 h1) (h1 i1) (i1 j1)
           (j1 j2) (j2 i2) (i2 h2) (h2 g2) (g2 f2) (f2 e2) (e2 d2) (d2 c2) (c2 b2) (b2 a2)
           (a2 a3) (a3 b3) (b3 c3) (c3 d3) (d3 e3) (e3 f3) (f3 g3) (g3 h3) (h3 i3) (i3 j3)
           (aoff boff) (boff coff) (coff doff) (doff eoff) (eoff foff)
           (foff goff) (goff hoff)
           (j3 exit)
  )
  (links finr 
           (exit rfin1) (rfin1 rfin2) (rfin2 rfin3) (rfin3 rfin4)
  )
  (links fing 
           (exit gfin1) (gfin1 gfin2) (gfin2 gfin3) (gfin3 gfin4)
  )
  (zone
     (name off-board)
     (players Green Red)
     (positions aoff boff coff doff eoff foff goff hoff)
  )
  (zone
     (name finish)
     (players Green Red)
     (positions aoff boff coff doff eoff foff goff hoff
	            rfin1 rfin2 rfin3 rfin4 gfin1 gfin2 gfin3 gfin4)
  )
  (zone
     (name safe)
     (players Green Red)
     (positions a1 b1 c1 d1 e1)
  )
  (positions (roll-place 427 152 481 209))
  (positions (exit   482 1 560 130))
  (positions (rfin1  490 7 540 57))
  (positions (rfin2  490 57 540 107))
  (positions (rfin3  490 107 540 157))
  (positions (rfin4  490 157 540 207))
  (positions (gfin1  540 7 590 57))
  (positions (gfin2  540 57 590 107)) 
  (positions (gfin3  540 107 590 157))
  (positions (gfin4  540 157 590 207))
)


(game
   (title "Senat")
   (description "点击棋盘右下的正方形凹槽掷骰子。骰子点数会随机出现1-5，其概率是切合原游戏的。原游戏掷四个木片看正反面：\1步：1个正面(4/16)；2步：2个正面(6/16)；3步：3个正面(4/16)；\4步，4个正面(1/16)；5步：0个正面(1/16)。\按骰子点数走相应步数。\\可以越过其他棋子，但不可和自己棋子处于同一个位置。\\若你的棋子可以走到对方棋子的位置，那么可以把对方棋子赶回出发点。左下角有标记的区域内的棋子不能被赶回。\\先把自己的四个棋子全部移到右侧区域胜利。")
   (history "Senat is an ancient Egyptian game, which dates back at least 4500 years;
       a wall-painting showing the game was found in an Egyptian tomb built sometime
       before 2600 B.C.   No one knows the full rules of the game.   This is one possible
       version, reconstructed by assumptions made about the board and pieces.   Senat is a
       simple race game, which probably spread through ancient Greece and Rome, and to other
       areas of the Middle East, evolving gradually into other race games like pachisi
       and backgammon.")
   (strategy "Consider when it's best to capture an opponent or just go for home.  Also
       note that the counts of 1, 2 and 3 are the most prevalent, so try to keep your men
       at a greater distance from your opponent.   Keeping your men close together may
       help your chances of retaliating after the opponent sends one of your men back.")
   (option "animate captures" false)
   (option "prevent flipping" true)
   (option "pass turn" forced)
   (drop-sound "Audio\\Dice_cup.wav")
   (move-sound "Audio\\Clack.wav")
   (capture-sound "")
   (players Green Red ?Dice-Toss )
   (turn-order (Green roll) ?Dice-Toss (Green non-roll) (Red roll) ?Dice-Toss (Red non-roll))
   
   (board
      (board-defs)  
   )

   (board-setup
      (Green (Green-Ball aoff coff eoff goff ) (roll off 99))
      (Red   (Red-Ball boff doff foff hoff ) (roll off 99) )
      (?Dice-Toss (1dice off 99) (2dice off 99) (3dice off 99)
                  (4dice off 99) (5dice off 99) )
   )

   (piece
      (name Red-Ball)
      (image Red "images\Senat\redball.bmp")
	  (description "先掷骰子，再走棋。")
      (help "先掷骰子，再走棋。")
      (moves 
        (move-type non-roll)   
         ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
               roll-place (verify (piece? 1dice)) capture back e (verify not-friend?)
               (if (position? exit) (place-in-finishr) )            
               (if enemy? (verify (not-in-zone? safe)) to back from cascade e from aoff (while not-empty? e) to) 
               add)
          ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
               roll-place (verify (piece? 2dice)) capture back e e (verify not-friend?)
               (if (position? exit) (place-in-finishr) )        
               (if enemy? (verify (not-in-zone? safe)) to back from cascade e e from aoff (while not-empty? e) to) 
               add)
          ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
               roll-place (verify (piece? 3dice)) capture back e e e (verify not-friend?)
               (if (position? exit) (place-in-finishr) )  
               (if enemy? (verify (not-in-zone? safe)) to back from cascade e e e from aoff (while not-empty? e) to) 
               add)
          ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
              roll-place (verify (piece? 4dice)) capture back e e e e (verify not-friend?) 
              (if (position? exit) (place-in-finishr) ) 
              (verify (not-in-zone? safe)) 
              (if enemy? (verify (not-in-zone? safe)) to back from cascade e e e e from aoff (while not-empty? e) to) 
               add)
         ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
              roll-place (verify (piece? 5dice)) capture back e e e e e (verify not-friend?)
              (if (position? exit) (place-in-finishr) )  
              (if enemy? (verify (not-in-zone? safe)) to back from cascade e e e e e from aoff (while not-empty? e) to) 
               add)
         (put-on-board a1 1dice)
         (put-on-board b1 2dice)
         (put-on-board c1 3dice)
         (put-on-board d1 4dice)
         (put-on-board e1 5dice)
      )
   )
   (piece
      (name Green-Ball)
      (image Green "images\Senat\greenbl.bmp")
	  (description "先掷骰子，再走棋。")
      (help "先掷骰子，再走棋。")
      (moves 
        (move-type non-roll)   
          ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
               roll-place (verify (piece? 1dice)) capture back e (verify not-friend?)
               (if (position? exit) (place-in-finishg) )            
               (if enemy? (verify (not-in-zone? safe)) to back from cascade e from aoff (while not-empty? e) to) 
               add)
          ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
               roll-place (verify (piece? 2dice)) capture back e e (verify not-friend?)
               (if (position? exit) (place-in-finishg) )        
               (if enemy? (verify (not-in-zone? safe)) to back from cascade e e from aoff (while not-empty? e) to) 
               add)
          ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
               roll-place (verify (piece? 3dice)) capture back e e e (verify not-friend?)
               (if (position? exit) (place-in-finishg) )  
               (if enemy? (verify (not-in-zone? safe)) to back from cascade e e e from aoff (while not-empty? e) to) 
               add)
          ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
              roll-place (verify (piece? 4dice)) capture back e e e e (verify not-friend?) 
              (if (position? exit) (place-in-finishg) ) 
              (verify (not-in-zone? safe)) 
              (if enemy? (verify (not-in-zone? safe)) to back from cascade e e e e from aoff (while not-empty? e) to) 
               add)
         ((verify (not-in-zone? off-board)) (verify (not-in-zone? finish))
              roll-place (verify (piece? 5dice)) capture back e e e e e (verify not-friend?)
              (if (position? exit) (place-in-finishg) )  
              (if enemy? (verify (not-in-zone? safe)) to back from cascade e e e e e from aoff (while not-empty? e) to) 
               add)
         (put-on-board a1 1dice)
         (put-on-board b1 2dice)
         (put-on-board c1 3dice)
         (put-on-board d1 4dice)
         (put-on-board e1 5dice)
      )
   )
   (piece
        (name 1dice)
        (image ?Dice-Toss "images\Dice\1.bmp")
	(help "你掷出了1点。")
		(drops (roll-place add) (roll-place add) (roll-place add) (roll-place add))			
    )
    (piece
        (name 2dice)
        (image ?Dice-Toss "images\Dice\2.bmp")
	(help "你掷出了2点。")
		(drops (roll-place add) (roll-place add) (roll-place add) (roll-place add)
		(roll-place add) (roll-place add))			
    )
    (piece
        (name 3dice)
        (image ?Dice-Toss "images\Dice\3.bmp")
	(help "你掷出了3点。")
		(drops (roll-place add) (roll-place add)
		  (roll-place add) (roll-place add))			
    )   
    (piece
        (name 4dice)
        (image ?Dice-Toss "images\Dice\4.bmp")
	(help "你掷出了4点。")
		(drops (roll-place add))			
    )
    (piece
        (name 5dice)
        (image ?Dice-Toss "images\Dice\5.bmp")
	(help "你掷出了5点。")
		(drops (roll-place add))			
    )
    (piece
        (name roll)
		(drops
            (move-type roll)
			(roll-place add)
		)
    ) 
   
  ; (win-condition (Red Green) (pieces-remaining 0) )
   (win-condition Green
        (absolute-config Green-Ball (gfin1 gfin2 gfin3 gfin4))
   )   
   (win-condition Red
        (absolute-config Red-Ball (rfin1 rfin2 rfin3 rfin4))
   )        
)
